import axios from "../index"
import type { SkusApi,SkusPageVO ,ApiResponse} from "@/common/type"


export default {
    //分页获取规格
    async page(page,pageSize) {
        return (await axios.get(`/admin/skus/${page}?pageSize=${pageSize}`)).data as ApiResponse<SkusPageVO>
    },
    // 新增规格
    async add(form) {
        return (await axios.post("/admin/skus", form)).data as ApiResponse<null>
    },
    // 删除规格
    async delete(ids) {
        const queryString = ids.map(id => `ids=${id}`).join('&');  
        return (await axios.delete(`/admin/skus?${queryString}`)).data as ApiResponse<null>
    },
    // 编辑规格
    async update(form) {
        return (await axios.put("/admin/skus", form)).data as ApiResponse<null>
    }
} as SkusApi